/*
 * Copyright (c) 2015 elion. All Rights Reserved.
 */
package com.guoyu.project.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.google.common.collect.Maps;
import com.guoyu.project.common.pagination.Pagination;
import com.guoyu.project.dao.College_CompanyDao;
import com.guoyu.project.model.Banner;
import com.guoyu.project.model.College_Company;


@Service
public class College_CompanyService {

    @Resource
    private College_CompanyDao college_CompanyDao;

    //save
    public void saveCollege_Company(College_Company college_company) {
    	college_CompanyDao.save(college_company);
    }

    //update
    public void updateCollege_Company(College_Company college_company) {
    	college_CompanyDao.update(college_company);
    }

    //delete
    public void deleteById(Integer college_id) {
    	college_CompanyDao.deleteById(college_id);
    }

    //查询 by id
    public College_Company queryById(Integer college_id) {
        return college_CompanyDao.queryById(college_id);
    }
 
    //分页
    public Pagination<College_Company> queryAllCollege_Company(int offset, int limit, Map<String, Object> params) {
        // 根据条件获取总记录数
        int total = college_CompanyDao.queryCollege_CompanyCount(params);

        // 构建分页对象，参数
        if (null == params) {
            params = Maps.newHashMap();
        }
        params.put(Pagination.OFFSET, offset);
        params.put(Pagination.LIMIT, limit);

        // 分页查询数据
        List<College_Company> College_CompanyList = college_CompanyDao.queryAllCollege_Company(params);
        return new Pagination(offset, limit, total, College_CompanyList);
    }

    public List<College_Company> queryAlllCollege_Company(Map<String, Object> params) {
        return college_CompanyDao.queryAllCollege_Company(params);
    }
}